#!/bin/env python3
# -*- coding:utf-8 -*-
"""
    [模块名]
    Add By : cdj <e4ting@qq.com> 2021-07-14 17:57:18
"""
from flask_restful          import Resource
from flask                  import request
from e4ting                 import util,log
# from common.utilredis       import NewID
# from e4ting.cache           import UUIDCache,FrpCache
# from e4ting.task            import Async
# from bin.master             import Master

class WebDev(Resource):

    def get(self, id=None):
        """ 查看函数列表 """
        from core.rpc.caller import NodeControl
        admin = NodeControl(None)
        uris = admin.list_uri()
        return dict(code=200, data=uris)

    def post(self, id=None):
        """ 分配FRP端口 """
        uuid = id or request.json.get("uuid", None)
        ret = self.get_or_alloc(uuid)
        Async().push_frp(uuid)
        return ret



